﻿using University.Workshop.DataAccess;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.Model;
using System.Collections.ObjectModel;
using University.Workshop.Business;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for WatchListDataAccessTest and is intended
    ///to contain all WatchListDataAccessTest Unit Tests
    ///</summary>
    [TestClass()]
    public class WatchListDataAccessTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for GetList
        ///</summary>
        [TestMethod()]
        public void GetListTest()
        {
            //UserRegistrationManager.RegisterUser("Natalia","Alfaro",'F',DateTime.Now,"alfaro.natalia.lorena@gmail.com","password123","password123","Cochabamba","Cochabamba","79393047","4530514")
            string email = "alfaro.natalia.lorena@gmail.com";
            UserRegistrationManager.RegisterUser("Natalia", "Alfaro", 'F', DateTime.Now, "alfaro.natalia.lorena@gmail.com", "password123", "password123", "Cochabamba", "Cochabamba", "79393047", "4530514");
            User user = UserDataAccess.GetUserByEmail(email);
            Product product = ProductRegistrationManager.RegisterNewProduct("Magic Mouse", "100", "Este mouse de Apple es inalambrico y se conecta a la computadora via bluetooh, te permite hacer un sin fin de funcionalidades", "Electronics", false, "Dollars", user.Id, "1");
            WatchListDataAccess.InsertProduct(user.Id, product.ProductId, "Some random comment");
            long userId = user.Id; // TODO: Initialize to an appropriate value
            Collection<WatchListItem> expected = null; // TODO: Initialize to an appropriate value
            Collection<WatchListItem> actual;
            actual = WatchListDataAccess.GetList(userId);
            Assert.AreNotEqual(expected, actual);
        }

        /// <summary>
        ///A test for ModifyComment
        ///</summary>
        [TestMethod()]
        public void ModifyCommentTest()
        {
            string email = "alfaro.natalia.lorena@gmail.com";
            UserRegistrationManager.RegisterUser("Natalia", "Alfaro", 'F', DateTime.Now, "alfaro.natalia.lorena@gmail.com", "password123", "password123", "Cochabamba", "Cochabamba", "79393047", "4530514");
            User user = UserDataAccess.GetUserByEmail(email);
            Product product = ProductRegistrationManager.RegisterNewProduct("Apple Magic Mouse", "100", "Este mouse de Apple es inalambrico y se conecta a la computadora via bluetooh, te permite hacer un sin fin de funcionalidades", "Electronics", false, "Bolivianos", user.Id, "1");
            WatchListDataAccess.InsertProduct(user.Id, product.ProductId, "Some random comment");
            long userId = user.Id; // TODO: Initialize to an appropriate value
            long productId = product.ProductId; // TODO: Initialize to an appropriate value
            string note = "new note hehe"; // TODO: Initialize to an appropriate value
            WatchListDataAccess.ModifyComment(userId, productId, note);
        }
    }
}
